#include "stdafx.h"
#include "FlashCallArgus.h"

namespace BFFlash
{
	CFlashCallArgus::CFlashCallArgus():BaseObjectImplConst()
	{
		
	}

	CFlashCallArgus::~CFlashCallArgus()
	{

	}

	LONG CFlashCallArgus::GetCount()
	{
		LONG nLen = 0;
		for ( std::vector<VARIANT*>::iterator it = m_pVariants.begin(); it != m_pVariants.end(); ++ it )
		{
			if( (*it) != NULL )
			{
				nLen++;
			}
		}
		return nLen;
	}

	HRESULT CFlashCallArgus::AddArgument(VARIANT * var)
	{
		m_pVariants.push_back( var );

		return S_OK;
	}

	HRESULT CFlashCallArgus::create(IFlashCallArgus ** ppArgs)
	{
		HRESULT hr;
		IFlashCallArgus * pFlashArgs = new CFlashCallArgus();
		if(pFlashArgs==NULL)
			return E_OUTOFMEMORY;
		//if(FAILED(hr))
			//return hr;
		*ppArgs = pFlashArgs;
		return S_OK;
	}

	HRESULT CFlashCallArgus::GetArgument( VARIANT* var,int nIndex )
	{

		LONG nLen = 0;
		for ( std::vector<VARIANT*>::iterator it = m_pVariants.begin(); it != m_pVariants.end(); ++ it )
		{
			if( nLen == nIndex )
			{
				VariantClear(var);
				VariantCopy(var,*it);
				break;
			}

			nLen++;
		}

		return S_OK;
	}
}